﻿function $import(path, type) {
    var i,
        base,
        src = "global.js",
        scripts = document.getElementsByTagName("script");

    for (i = 0; i < scripts.length; i++) {
        if (scripts[i].src.match(src)) {
            base = scripts[i].src.replace(src, "");
            break;
        }
    }

    if (type == "css") {
        document.write("<" + "link href=\"" + base + path + "\" rel=\"stylesheet\" type=\"text/css\"></" + "link>");
    } else {
        document.write("<" + "script src=\"" + base + path + "\"></" + "script>");
    }
}